<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
/*
 * 计算时间
 * */
function Ftime($time)
{
    $diff = time() - $time;

    if ($diff < 60) {
        return "刚刚";
    } elseif ($diff < 3600) {
        return ceil($diff / 60) . "分钟之前";
    } elseif ($diff < 86400) {
        return ceil($diff / 3600) . "小时之前";
    } elseif ($diff < (86400 * 7)) {
        return ceil($diff / 86400) . "天之前";
    } else {
        return date('Y-m-d H:i:s', $time);
    }
}